#include "Chassis.h"
#include <iostream>
#include <iomanip>

Chassis::Chassis() 
    : wheelbase(0), track(0), minGroundClearance(0), minTurningRadius(0), maxRange(0), tireSize(0) {}

Chassis::Chassis(const std::string& id, const std::string& model, double wheelbase,
                 double track, double minGroundClearance, double minTurningRadius,
                 const std::string& driveMode, double maxRange,
                 const std::string& tireModel, double tireSize)
    : id(id), model(model), wheelbase(wheelbase), track(track), 
      minGroundClearance(minGroundClearance), minTurningRadius(minTurningRadius),
      driveMode(driveMode), maxRange(maxRange), tireModel(tireModel), tireSize(tireSize) {}

// Getters
std::string Chassis::getId() const { return id; }
std::string Chassis::getModel() const { return model; }
double Chassis::getWheelbase() const { return wheelbase; }
double Chassis::getTrack() const { return track; }
double Chassis::getMinGroundClearance() const { return minGroundClearance; }
double Chassis::getMinTurningRadius() const { return minTurningRadius; }
std::string Chassis::getDriveMode() const { return driveMode; }
double Chassis::getMaxRange() const { return maxRange; }
std::string Chassis::getTireModel() const { return tireModel; }
double Chassis::getTireSize() const { return tireSize; }

// Setters
void Chassis::setId(const std::string& id) { this->id = id; }
void Chassis::setModel(const std::string& model) { this->model = model; }
void Chassis::setWheelbase(double wheelbase) { this->wheelbase = wheelbase; }
void Chassis::setTrack(double track) { this->track = track; }
void Chassis::setMinGroundClearance(double minGroundClearance) { this->minGroundClearance = minGroundClearance; }
void Chassis::setMinTurningRadius(double minTurningRadius) { this->minTurningRadius = minTurningRadius; }
void Chassis::setDriveMode(const std::string& driveMode) { this->driveMode = driveMode; }
void Chassis::setMaxRange(double maxRange) { this->maxRange = maxRange; }
void Chassis::setTireModel(const std::string& tireModel) { this->tireModel = tireModel; }
void Chassis::setTireSize(double tireSize) { this->tireSize = tireSize; }

void Chassis::display() const {
    std::cout << "底盘信息:" << std::endl;
    std::cout << "  编号: " << id << std::endl;
    std::cout << "  型号: " << model << std::endl;
    std::cout << "  轴距: " << wheelbase << "mm" << std::endl;
    std::cout << "  轮距: " << track << "mm" << std::endl;
    std::cout << "  最小离地间隙: " << minGroundClearance << "mm" << std::endl;
    std::cout << "  最小转弯半径: " << minTurningRadius << "m" << std::endl;
    std::cout << "  驱动形式: " << driveMode << std::endl;
    std::cout << "  最大行程: " << maxRange << "KM" << std::endl;
    std::cout << "  轮胎型号: " << tireModel << std::endl;
    std::cout << "  轮胎尺寸: " << tireSize << "mm" << std::endl;
}